home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / ROM_Kernel_Manuals / Devices / iffp / 8svx.h next >
Encoding:
C/C++ Source or Header  |  1998-04-26  |  3.4 KB  |  94 lines

  1. /*-----------------------------------------------------------------------*
  2.  * 8SVX.H  Definitions for 8-bit sampled voice (VOX).   2/10/86
  3.  *
  4.  * By Jerry Morrison and Steve Hayes, Electronic Arts.
  5.  * This software is in the public domain.
  6.  * 
  7.  * Modified for use with iffparse.library 05/91 - CAS_CBM
  8.  *
  9.  * This version for the Amiga computer.
  10.  *----------------------------------------------------------------------*/
  11. #ifndef EIGHTSVX_H
  12. #define EIGHTSVX_H
  13.  
  14. #ifndef COMPILER_H
  15. #include "iffp/compiler.h"
  16. #endif
  17.  
  18. #include "iffp/iff.h"
  19.  
  20. #define ID_8SVX      MAKE_ID('8', 'S', 'V', 'X')
  21. #define ID_VHDR      MAKE_ID('V', 'H', 'D', 'R')
  22.  
  23. #define ID_ATAK      MAKE_ID('A', 'T', 'A', 'K')
  24. #define ID_RLSE      MAKE_ID('R', 'L', 'S', 'E')
  25.  
  26. /* defined in iffp/iff.h
  27. #define ID_NAME      MAKE_ID('N', 'A', 'M', 'E')
  28. #define ID_Copyright MAKE_ID('(', 'c', ')', ' ')
  29. #define ID_AUTH      MAKE_ID('A', 'U', 'T', 'H')
  30. #define ID_ANNO      MAKE_ID('A', 'N', 'N', 'O')
  31. #define ID_BODY      MAKE_ID('B', 'O', 'D', 'Y')
  32. */
  33.  
  34.  
  35. /* ---------- Voice8Header ---------------------------------------------*/
  36. typedef LONG Fixed;    /* A fixed-point value, 16 bits to the left of
  37.              * the point and 16 to the right. A Fixed is a
  38.              * number of 2**16ths, i.e. 65536ths. */
  39. #define Unity 0x10000L    /* Unity = Fixed 1.0 = maximum volume */
  40.  
  41. /* sCompression: Choice of compression algorithm applied to the samples. */
  42. #define sCmpNone       0    /* not compressed */
  43. #define sCmpFibDelta   1    /* Fibonacci-delta encoding (Appendix C) */
  44.                 /* Could be more kinds in the future. */
  45. typedef struct {
  46.     ULONG oneShotHiSamples,    /* # samples in the high octave 1-shot part */
  47.           repeatHiSamples,    /* # samples in the high octave repeat part */
  48.           samplesPerHiCycle;    /* # samples/cycle in high octave, else 0 */
  49.     UWORD samplesPerSec;    /* data sampling rate */
  50.     UBYTE ctOctave,        /* # of octaves of waveforms */
  51.           sCompression;        /* data compression technique used */
  52.     Fixed volume;        /* playback nominal volume from 0 to Unity
  53.                  * (full volume). Map this value into
  54.                  * the output hardware's dynamic range.
  55.                  */
  56.     } Voice8Header;
  57.  
  58. /* ---------- NAME -----------------------------------------------------*/
  59. /* NAME chunk contains a CHAR[], the voice's name. */
  60.  
  61. /* ---------- Copyright ------------------------------------------------*/
  62. /* "(c) " chunk contains a CHAR[], the FORM's copyright notice. */
  63.  
  64. /* ---------- AUTH -----------------------------------------------------*/
  65. /* AUTH chunk contains a CHAR[], the author's name. */
  66.  
  67. /* ---------- ANNO -----------------------------------------------------*/
  68. /* ANNO chunk contains a CHAR[], the author's text annotations. */
  69.  
  70. /* ---------- Envelope ATAK & RLSE -------------------------------------*/
  71. typedef struct {
  72.     UWORD duration;    /* segment duration in milliseconds, > 0 */
  73.     Fixed dest;        /* destination volume factor */
  74.     } EGPoint;
  75.  
  76. /* ATAK and RLSE chunks contain an EGPoint[], piecewise-linear envelope. */
  77.  
  78. /* The envelope defines a function of time returning Fixed values.
  79.  * It's used to scale the nominal volume specified in the Voice8Header.
  80.  */
  81.  
  82. /* ---------- BODY -----------------------------------------------------*/
  83. /* BODY chunk contains a BYTE[], array of audio data samples. */
  84. /* (8-bit signed numbers, -128 through 127.) */
  85.  
  86.  
  87. /* ---------- 8SVX Writer Support Routines -----------------------------*/
  88.  
  89. /* Just call this macro to write a VHDR chunk. */
  90. #define PutVHDR(iff, vHdr)  \
  91.     PutCk(iff, ID_VHDR, sizeof(Voice8Header), (BYTE *)vHdr)
  92.  
  93. #endif
  94.